package basicShapes;

import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import image.Image;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "x",
    "y",
    "height",
    "width"
})
@XmlRootElement
public class Rectangle extends Image {

	@XmlAttribute
	protected int x;
	@XmlAttribute
	protected int y;
	@XmlAttribute
	protected int height;
	@XmlAttribute
	protected int width;
	
	public Rectangle() {
		
	}
	
	public Rectangle (int x, int y, int width, int height){
		this.x = x;
		this.y = y;
		this.width = width;
		this.height = height;
	}
	public void draw( Graphics2D g){
		g.draw(new Rectangle2D.Double(x, y, width, height));
	}
	
	public String toString(){
		return "Rectangle - x:"+this.x
						+" y:"+this.y
						+" width: "+this.width
						+" height: "+this.height;
	}
}
